﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DHQGHN.DAL.Common
{
    public class ConnectionUtil
    {
        public static String BuildConnectionString(string dataSource, String initialCataLog, String userId, String password)
        {
            return String.Format("data source={0};initial catalog={1};persist security info=True;user id={2};password={3};MultipleActiveResultSets=True", dataSource, initialCataLog, userId, password);
        }

        #region Connection Name Constant
        public static String DEFAULT_CONN_STRING
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["DHQGHN.DefaultConnection"].ConnectionString;
            }
        }
        //public static String TKTHDS_CONNECTION_STRING
        //{
        //    get
        //    {
        //        return ConfigurationManager.ConnectionStrings["DHQGHN.ConnectionString"].ConnectionString;
        //    }
        //}
        public static String DHQGHN_TDT_CONNECTION_STRING
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["DHQGHN_TDT.ConnectionString"].ConnectionString;
            }
        }
         
        public static String DHQGHN_CONNECTION_STRING
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["DHQGHN.ConnectionString"].ConnectionString;
            }
        }
        

        public static String TKTHDS_METADATA_CONNECTION_STRING
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["DHQGHN_METADATA.ConnectionString"].ConnectionString;
            }
        }
      
        public static String DHQG_ADMIN_CONNECTION_STRING
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["DHQGHN_ADMIN.ConnectionString"].ConnectionString;
            }
        }
        public static string MANPOWER_WORK_SURVEY_CONNECTION_STRING
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["Viettel.VTICT.MANPOWER_WORK_SURVEY.ConnectionString"].ConnectionString;
            }
        }
        public static string MANPOWER_WORK_SURVEY_ADMIN_CONNECTION_STRING
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["Viettel.VTICT.MANPOWER_WORK_SURVEY_ADMIN.ConnectionString"].ConnectionString;
            }
        }
        public static String MANPOWER_WORK_SURVEY_DEFAULT_CONNECTION_STRING
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["Viettel.VTICT.MANPOWER_WORK_SURVEY.DefaultConnection"].ConnectionString;
            }
        }
        public static String EFORM_DESIGN_CONNECTION_STRING
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["Viettel.VTICT.EFORM_DESIGN.ConnectionString"].ConnectionString;
            }
        }

        public static String DbNameConfig (string name)
        {
            return ConfigurationManager.ConnectionStrings[name].ConnectionString;
        }

        public static string DHQGHN_HTTTKH_CONNECTIONSTRING
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["HTTTKH_DHQG.ConnectionString"].ConnectionString;
            }
        }
        #endregion
    }
}
